package com.ruoyi.common.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.CustomExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * MrPing
 */
@Configuration
public class DelayedVipEndTimeRabbitConfig {

    @Bean
    public CustomExchange delayedVipExchange() {
        Map<String, Object> args = new HashMap<>();
        args.put("x-delayed-type", "direct");
        return new CustomExchange("yuanjuDelayedVipExchange", "x-delayed-message", true, false, args);
    }

    @Bean
    public Queue delayedVipQueue() {
        return new Queue("yuanjuDelayedVipQueue", true,false,false);
    }

    @Bean
    public Binding delayedVipBinding() {
        return BindingBuilder.bind(delayedVipQueue()).to(delayedVipExchange()).with("delayedVipEndKey").noargs();
    }
}
